#ifndef _D3D_WINDOW_H_
#define _D3D_WINDOW_H_

#include<d3d9.h>
#include "D3dRender.h"

class D3DWindow
{
public:
	static D3DWindow * create(const char *title, int width = 640, int height = 480, int x = 150, int y = 150);
	static void destroy(D3DWindow * &pWin);
	
	void start();

private:
	D3DWindow(HWND hWnd, HINSTANCE hInstance)
		:m_hWnd(hWnd), m_hInstance(hInstance), m_pRender(NULL){}

	~D3DWindow();

	static LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
	bool init();
	void render();
	void msgLoop();

private:
	HWND m_hWnd;
	HINSTANCE m_hInstance;
	D3DRender *m_pRender;
};

#endif